OpenStack Havana - Neutron - Network Example#1
2013/10/29 |
Configure virtual networking with OpenStack Network Service (Neutron).
For an example, configure simple flat networking on here.
Configure basic settings first on Controle Node, Network Node, Compute Node first.
Furthermore, it needs that Network Node and Conpute Node have 2 network interfaces and assign internal network on eth1.
|
[1] | Configure on Control Node. |
[root@dlp ~(keystone)]#
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini # add at the last
[OVS]
tenant_network_type = vlan network_vlan_ranges = physnet1 bridge_mappings = physnet1:br-eth1 /etc/rc.d/init.d/neutron-server restart Stopping neutron: [ OK ] Starting neutron: [ OK ] |
[2] | Configure Network Node and Compute Node. ( Set on both Node like follows ) |
[root@network ~(neutron)]# ovs-vsctl add-br br-eth1 # add bridge [root@network ~(neutron)]# ovs-vsctl add-port br-eth1 eth1 # add eth1 in bridge above
[root@network ~(neutron)]#
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini # add at the last
[OVS]
tenant_network_type = vlan network_vlan_ranges = physnet1 bridge_mappings = physnet1:br-eth1 /etc/rc.d/init.d/neutron-openvswitch-agent restart Stopping neutron-openvswitch-agent: [ OK ] Starting neutron-openvswitch-agent: [ OK ] |
[3] | Create a network. It's OK to work on any Node. ( this example works on Compute Node ) |
[root@node01 ~(keystone)]# keystone tenant-list +----------------------------------+---------+---------+ | id | name | enabled | +----------------------------------+---------+---------+ | 97be94660c2043e58fee407bc9cde0d5 | admin | True | | 17867024fb23470f8005a15c6ccfed44 | service | True | +----------------------------------+---------+---------+ # create a network "sharednet1" [root@node01 ~(keystone)]# neutron net-create --tenant-id 17867024fb23470f8005a15c6ccfed44 sharednet1 --shared --provider:network_type flat --provider:physical_network physnet1 Created a new network: +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | id | cd40926d-9ed9-41bf-8a9d-8bec6f0152cb | | name | sharednet1 | | provider:network_type | flat | | provider:physical_network | physnet1 | | provider:segmentation_id | | | shared | True | | status | ACTIVE | | subnets | | | tenant_id | 17867024fb23470f8005a15c6ccfed44 | +---------------------------+--------------------------------------+ # create subnet "192.168.100.0/24" on "sharednet1" above [root@node01 ~(keystone)]# neutron subnet-create --tenant-id 17867024fb23470f8005a15c6ccfed44 sharednet1 192.168.100.0/24 Created a new subnet: +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | allocation_pools | {"start": "192.168.100.2", "end": "192.168.100.254"} | | cidr | 192.168.100.0/24 | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | 192.168.100.1 | | host_routes | | | id | fe865e29-0409-49f5-b2c9-367d9c885987 | | ip_version | 4 | | name | | | network_id | cd40926d-9ed9-41bf-8a9d-8bec6f0152cb | | tenant_id | 17867024fb23470f8005a15c6ccfed44 | +------------------+------------------------------------------------------+ # confirm settings [root@node01 ~(keystone)]# neutron net-list +--------------------------------------+------------+-------------------------------------------------------+ | id | name | subnets | +--------------------------------------+------------+-------------------------------------------------------+ | cd40926d-9ed9-41bf-8a9d-8bec6f0152cb | sharednet1 | fe865e29-0409-49f5-b2c9-367d9c885987 192.168.100.0/24 | +--------------------------------------+------------+-------------------------------------------------------+ |
[4] | Assign the network just created to an Instance and boot it. |
[root@node01 ~(keystone)]# nova image-list +--------------------------------------+---------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+---------+--------+--------+ | 46042f47-c307-4fce-af0d-a1b2c14d6d78 | CentOS6 | ACTIVE | | +--------------------------------------+---------+--------+--------+
[root@node01 ~(keystone)]#
[root@node01 ~(keystone)]# nova boot --flavor 2 --image CentOS6 --security_group default --nic net-id=cd40926d-9ed9-41bf-8a9d-8bec6f0152cb CentOS_64
nova list +--------------------------------------+-----------+--------+------------+-------------+--------------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-----------+--------+------------+-------------+--------------------------+ | 9b9f2275-7f3d-428c-ae2d-8f9fe02fcbcb | CentOS_64 | ACTIVE | None | Running | sharednet1=192.168.100.2 | +--------------------------------------+-----------+--------+------------+-------------+--------------------------+ # assing an IP address 192.168.100.10/24 to br-eth1 [root@node01 ~(keystone)]# ip addr add 192.168.100.10/24 dev br-eth1 # login to Instance [root@node01 ~(keystone)]# ssh 192.168.100.2 The authenticity of host '192.168.100.2 (192.168.100.2)' can't be established. RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:a5:3c:84. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.100.2' (RSA) to the list of known hosts. root@192.168.100.2's password: Last login: Wed Oct 23 04:40:30 2013 [root@host-192-168-100-2 ~]# # just logined |